<?php

namespace App\Http\Controllers\Admin;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Gregwar\Captcha\CaptchaBuilder;
use Session;
use App\Model\Admin\AdminLogin;
use DB;
use App;
use Artisan;

class ConfigController extends Controller
{
    /**
     * 渲染登陆页面
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        //
       $data = DB::table('mode')->where('id',1)->first();
       return view('admin.config',['mode'=>$data]);
    }

    //改变网站模式
    public function mode(Request $request)
    {
        //dd($request->mode);
        DB::table('mode')->where('id',1)->update(['mode'=>$request->mode]);

        if($request->mode){
             
          Artisan::call('down');

        }else{
            Artisan::call('up');
        }



        return redirect('/admin/config');
    }


  



}
